package aom.ju.ss.mode

import aom.ju.ss.utils.BigDecimalUtils
import java.lang.Exception

data class CutOrderInfo(
    val code: Int,
    val count: Int,
    val `data`: CutOrderInfoData,
    val error_type: Int,
    val mess: String,
    val msg: String,
    val status: Int
)

data class CutOrderInfoData(
    val goods_info: CutOrderInfoGoodsInfo,
    val headimgurl: String,
    val nickname: String,
    val help_cut: Int,// "是否已经帮砍  0否"
    val help_cut_list: List<HelpCutList>
)

data class HelpCutList(val headimgurl: String, val nickname: String)

data class CutOrderInfoGoodsInfo(
//		"goods_name": "商品名称",
//			"goods_image": "商品图片",
//			"price": "砍后价",
//			"original_price": "原价",
//			"end_time": "结束时间",
//			"cut_people_num": "总砍价人数",
//			"cut_help_num": "已砍价次数",
//			"cut_money": "每次砍掉的金额",
//			"cut_help_money": "已经砍掉的金额"

    val cut_help_num: String,
    val cut_money: String,
    val cut_people_num: String,
    val end_time: String,
    val goods_image: String,
    val goods_name: String,
    val original_price: String,
    val price: String,
    val cut_help_money: String


) {

    var p: Int? = 0
        get() {
            try {
                val p = BigDecimalUtils.div(cut_people_num, cut_help_num, 2)
                field = BigDecimalUtils.mul(p, "100", 0).toIntOrNull()
            } catch (ex: Exception) {

            }

            if (field == null) {
                field = 0
            }
            return field

        }
}